<template>
	<el-container>
		<el-header style="height: auto;">
			<sc-select-filter :data="filterData" :label-width="80" @on-change="filterChange"></sc-select-filter>
		</el-header>
		<el-main class="nopadding">
			<scTable ref="table" :apiObj="apiObj" row-key="runId" stripe remoteSort remoteFilter>
				<el-table-column label="#" type="index" width="50"></el-table-column>
				<el-table-column label="流水号" prop="id" width="150"></el-table-column>
				<el-table-column label="流程标题" prop="flowTitle" width="150"></el-table-column>
				<el-table-column label="登记人" prop="userName" width="150"></el-table-column>
				<el-table-column label="部门" prop="deptName" width="150"></el-table-column>
				<el-table-column label="填表日期" prop="time" width="150" :show-overflow-tooltip="true"></el-table-column>
				<el-table-column label="值班类型" prop="attendType" width="100">
					<template #default="scope">
						<el-tag v-if="scope.row.attendType=='A'" type="success">节假日值班</el-tag>
						<el-tag v-else-if="scope.row.attendType=='B'" type="danger">轮流值班</el-tag>
						<el-tag v-else-if="scope.row.attendType=='C'" type="warning">加班值班</el-tag>
					</template>
				</el-table-column>
				<el-table-column label="值班事由" prop="reason" width="300" :show-overflow-tooltip="true"></el-table-column>
				<el-table-column label="操作" fixed="right" align="right" width="100">
					<template #default="scope">
						<el-button-group>
							<el-button text type="primary" size="small" @click="readBpmDetails(scope.row,scope.$index)">查看</el-button>
						</el-button-group>
					</template>
				</el-table-column>
			</scTable>
		</el-main>
	</el-container>
</template>

<script>
import scSelectFilter from '@/components/scSelectFilter'
export default {
	name: 'My Attend Record',
	components: {
		scSelectFilter,
	},
	data() {
		return {
			dialog: {
				save: false,
				detailsSave:false
			},
			filterData: [
				{
					title: "日期范围",
					key: "date",
					multiple: false,
					options: [
						{
							label: "全部",
							value: ""
						},
						{
							label: "今日",
							value: "1"
						},
						{
							label: "昨日",
							value: "2"
						},
						{
							label: "一周内",
							value: "3"
						},
						{
							label: "一月内",
							value: "4"
						},
						{
							label: "一月前",
							value: "5"
						}
					]
				}
			],
			apiObj: this.$API.office.attend.getMyLeaveList,
			search: {
				date:''
			}
		}
	},
	mounted() {
	},
	methods: {
		filterChange(data){
			this.search.date = data.date;
			this.$refs.table.upData(this.search)
		},
		readBpmDetails(row,index)
		{
			this.$nextTick(() => {
				this.$router.replace({
					path: '/bpm/handle/read',
					query: {
						runId: row.runId
					}
				})
			})
		},
	}
}
</script>

<style>
</style>
